import request from '@/config/axios'

export interface SchoolVO {
  schoolName: string
  schoolCode: string
  id: number
  sourceId: string
  sourceType: number
  deptId: number
  parentDeptId: number
  schoolNature: number
  schoolType: number
  status: number
  province: number
  city: number
  region: number
  attribute: number
  address: string
  contact: string
  schoolProfile: string
  longitude: number
  latitude: number
}

// 查询学校分页
export const getSchoolPage = async (params) => {
  return await request.get({ url: `/cmis/school/page`, params })
}

// 查询学校列表
export const getSchoolList = async (params) => {
  return await request.get({ url: `/cmis/school/list`, params })
}

// 查询学校列表
export const querySchoolList = async (data) => {
  return await request.post({ url: `/cmis/school/query`, data })
}

// 查询跑步学校信息列表【忽略租户】
export const selectAllBaseSchoolList = async (data) => {
  return await request.post({ url: `/cmis/school/selectAll`, data })
}

// 查询学校详情
export const getSchool = async (id: number) => {
  return await request.get({ url: `/cmis/school/get?id=` + id })
}

// 新增学校
export const createSchool = async (data: SchoolVO) => {
  return await request.post({ url: `/cmis/school/create`, data })
}

// 修改学校
export const updateSchool = async (data: SchoolVO) => {
  return await request.put({ url: `/cmis/school/update`, data })
}

// 删除学校
export const deleteSchool = async (id: number) => {
  return await request.delete({ url: `/cmis/school/delete?id=` + id })
}

// 导出学校 Excel
export const exportSchool = async (params) => {
  return await request.download({ url: `/cmis/school/export-excel`, params })
}

// 批量删除学校
export const batchDeleteSchool = async (ids: Array<string>) => {
  return await request.delete({ url: `/cmis/school/batchDelete?ids=` + ids })
}
